﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MySql.Data.MySqlClient;

/// <summary>
/// Descripción breve de ConveniosDA
/// </summary>
public class ConveniosDA
{
    public static string EliminarConveniosColegios(string colegioid)
    {   

        MySqlConnection conexion = Conexion.obtConexion();
        string consulta = @"DELETE FROM convenios
                            WHERE colegioid=" + colegioid;
        MySqlCommand comando = new MySqlCommand(consulta, conexion);
        try
        {
            conexion.Open();
            comando.ExecuteReader();
            conexion.Close();
            return "ok";
        }
        catch
        {
            return consulta;
        }
    }
    public static string EliminarConveniosInstituciones(string Institucionid)
    {   

        MySqlConnection conexion = Conexion.obtConexion();
        string consulta = @"DELETE FROM convenios
                            WHERE `convenios`.`INTITUCIONID`=" + Institucionid;
        MySqlCommand comando = new MySqlCommand(consulta, conexion);
        try
        {
            conexion.Open();
            comando.ExecuteReader();
            conexion.Close();
            return "ok";
        }
        catch
        {
            return consulta;
        }
    }
    public static string EliminarConveniosFarmacia(string FARMACIAID)
    {   

        MySqlConnection conexion = Conexion.obtConexion();
        string consulta = @"DELETE FROM convenios
                            WHERE `convenios`.`FARMACIAID`=" + FARMACIAID;
        MySqlCommand comando = new MySqlCommand(consulta, conexion);
        try
        {
            conexion.Open();
            comando.ExecuteReader();
            conexion.Close();
            return "ok";
        }
        catch
        {
            return consulta;
        }
    }
}
